<?php
namespace api\modules\v1\controllers;

use Yii;
use api\components\ApiController;
use api\modules\v1\models\Chat;



/**
 *
 * @author ZCY
 */
class ChatController extends ApiController
{
    /**
     * 发送留言信箱
     * @author ZCY
     */
    public function actionSend()
    {
        $params = Yii::$app->request->post();
        $model = new Chat();
        $model->setScenario(Chat::SCENARIO_SEND);
        $model->load($params, '');
        if ($result = $model->send()) {
            return ['message' => '发送留言成功','data'=>$result];
        }
    }
    
    /**
     * 留言信息列表
     */
    public function actionList(){
        $params = Yii::$app->request->post();
        $model = new Chat();
        $model->setScenario(Chat::SCENARIO_LIST);
        $model->load($params, '');
        if ($result = $model->chatlist()) {
            return ['message' => '留言列表获取成功','data'=>$result];
        }
    }
}
